//
//  UIImage+Category.h
//  HMDemo
//
//  Created by mengxiangyu on 2017/6/21.
//  Copyright © 2017年 mengxiangyu. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIImage (Category)
+ (NSData *)imageDataCompressWithSourceImageData:(NSData *)imageData compressionQualityOfK:(CGFloat)quality;
/**
 新的图片压缩方案
 http://www.jianshu.com/p/9b47fc25f526
 */
+ (NSData *)imageDataCompressWithSourceImageData:(NSData *)imageData orImage:(UIImage *)sourceImage;
// 指定压缩大小以k为单位
+ (NSData *)imageDataCompressWithSourceImageData:(NSData *)imageData orImage:(UIImage *)sourceImage compressionQualityOfK:(CGFloat)quality;
// 压缩图片到指定kb
+ (UIImage *)scaleImage:(UIImage *)image toKb:(NSInteger)kb;
+ (NSData *)scaleDataImage:(UIImage *)image toKb:(NSInteger)kb;

// 拉伸图片尺寸
+ (UIImage *)resizImageWithImage:(NSString *)imageName;
// 截取某个视图
+ (instancetype)captureWithView:(UIView *)view;
// 截取图片的某部分
+ (UIImage *)imageFromImage:(UIImage *)image inRect:(CGRect)rect;
// 矫正图片的位置(一定要在刚获取图片就矫正，不然不管用)
+ (UIImage *)takePhotoImageOrientation:(UIImage *)aImage;

// 压缩图片
+ (UIImage *)scaleToSize:(UIImage *)image size:(CGSize)size;
@end
